**************************************************
* This program performs the additional analyses  *
* on IPO activity                                *
* reported in Table B1                           *
**************************************************


	use "C:\cow\ipopanel.dta",clear

	drop if yr < 1996
	encode incorp, gen(istateFE)
*	encode ind, gen(indFE)

	*Create macros for date when law was passed
		local DE_cow = date("01Jul2000","DMY")
		local OK_cow = date("01Nov2001","DMY")
		local MO_cow = date("01Oct2003","DMY")
		local KS_cow = date("01Jan2005","DMY")
		local TX_cow = date("01Jan2006","DMY")
		local NV_cow = date("01Oct2007","DMY")
		local NJ_cow = date("11Mar2011","DMY")
		local MD_cow = date("01Oct2014","DMY")
		local WA_cow = date("01Jan2016","DMY")
		
	
		*cow: indicator equal to one if firm is incorporated in a state that has passed a COW law
		gen cow = 0
		local statelist "DE OK MO KS TX NV NJ MD WA"
		foreach state of local statelist {
				replace cow = 1 if incorp == "`state'" & yr > year(``state'_cow')
				}
				
		gen ipo=0 
		replace ipo=1 if ipovolume>0
		gen l_iponumber = exp(l_ln_iponumber)-1

		local statelist "DE OK MO KS TX NV NJ MD WA"
		gen treatment = 0
		foreach state of local statelist {
				replace treatment = 1 if incorp == "`state'"
		}

		
**********************************
* Table B1 Panel A Summary stats *
**********************************

		winsor2 n_ipo n_vc iponumber vcnumber ln_iponumber ln_vcnumber ln_n_ipo ln_v_ipo ln_n_vc ln_v_vc pctchg_stategdppc ln_statepopulation ln_stateemployment vwret l_vwmb, replace cuts(1 99) trim
		
		estpost tabstat cow ln_n_ipo ln_n_vc pctchg_stategdppc ln_statepopulation ln_stateemployment vwret l_vwmb , statistics (n mean sd p25 p50 p75) columns(statistics)

		
********************************
* Table B1 Panel B Regressions *
********************************

		reghdfe ln_n_ipo cow , absorb(istateFE yr) vce(cluster yr#istateFE )
		reghdfe ln_n_ipo cow chg_stategdppc ln_statepopulation ln_stateemployment vwret vwmb, absorb(istateFE yr) vce(cluster yr#istateFE )
		reghdfe ln_v_ipo cow , absorb(istateFE yr) vce(cluster yr#istateFE )
		reghdfe ln_v_ipo cow chg_stategdppc ln_statepopulation ln_stateemployment vwret vwmb, absorb(istateFE yr) vce(cluster yr#istateFE )

